
<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
  <meta name="description" content="xms">
  <meta name="author" content="Xms">
  <link rel="icon" href="/content/favicon.ico">

  <title>组织 - 安全 - 安全角色 - 角色编辑</title>

  <!-- Bootstrap core CSS -->
  <link href="/content/css/bootstrap3.3.5/bootstrap.min.css" rel="stylesheet">

  <!-- Custom styles for this template -->
  <link href="/content/css/font-awesome.min.css" rel="stylesheet">
  <link href="/content/css/common.css" rel="stylesheet">
  <link href="/content/js/jquery-toast/jquery.toast.min.css" rel="stylesheet">
  <link id="themeLink" href="/content/css/theme/default.css" rel="stylesheet" />
  <!-- Bootstrap core JavaScript ================================================== -->
  <!-- Placed at the end of the document so the pages load faster -->
  <script src="/content/js/jquery.min.js"></script>
  <script src="/content/js/bootstrap.min.js"></script>
  <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
  <script src="/content/js/ie10-viewport-bug-workaround.js"></script>
  <script src="/content/js/jquery.bootstrap.min.js"></script>
  <script src="/content/js/json2.js"></script>
  <script src="/content/js/xms.utility.js"></script>
  <script src="/content/js/jquery-ui-1.10.3/ui/jquery.ui.core.js"></script>
  <script src="/content/js/jquery-ui-1.10.3/ui/jquery.ui.widget.js"></script>
  <script src="/content/js/jquery-ui-1.10.3/ui/jquery.ui.mouse.js"></script>
  <script src="/content/js/jquery-ui-1.10.3/ui/jquery.ui.draggable.js"></script>
  <script src="/content/js/jquery-toast/jquery.toast.min.js"></script>
  <script src="/content/js/xms.jquery.js"></script>
  <script src="/content/js/xms.web.js"></script>
  <script src="/content/js/commonlabels.js"></script>
  <script src="/content/js/common/pagecontext.js"></script>
  <script src="/api/user/usercontext"></script>
  <script>
  jQuery(function () {
    Xms.Web.Loading();
    if (typeof parent !== 'undefined') {
      if (parent != window) {//判断当前页面是否为子页面
        $('body').addClass('xms-subpage');
      }
    }
  });
  function changeTheme(body,themename) {
    $("#themeLink").attr('href', '/content/css/theme/' + themename+'.css');
  }
</script>
  <style>
  body {
    padding-top: 0;
  }
</style>
</head>

<body data-spy="scroll" data-target="#myScrollspy">
<div class="container-fluid" id="body">
  <div class="row">
    <div class="shadeBox" style="background-color:#000000; opacity:0.5;width:100%;position:absolute;z-index:10;display:none;"></div>
    <div class="col-md-12" id="main" style="margin-bottom:80px;">
      <div><br class="breadcrumb" /></div>
      <div id="content"></div>
      <div class="page-render-wrap">
        <!--main-->
        <div class="row">
          <div class="col-sm-2" id="myScrollspy">
            <div class="list-group" id="myNav">
              <a href="#section-1" class="active list-group-item" data-target="#section-1">安全角色 <em class="pull-right glyphicon glyphicon glyphicon-chevron-right"></em></a>
              <a href="#section-2" class="list-group-item" data-target="#section-2">成员 <em class="pull-right glyphicon glyphicon glyphicon-chevron-right"></em></a>
            </div>
          </div>
          <div class="col-sm-10" id="scroll-body">
            <div id="section-1" class="panel panel-default">
              <div class="panel-heading">
                <h3 class="panel-title">
                  <a data-toggle="collapse"
                     href="#collapseTwo">
                    <strong>组织 - 安全 - 安全角色 - 角色编辑</strong>
                  </a>
                </h3>
              </div>
              <div id="collapseTwo" class="panel-collapse collapse in">
                <div class="panel-body">
                  <form id="editform" class="form-horizontal" data-jsonajax="true" data-formdata="false" data-istip="true" action="/xms/api/security/role/update" method="post">
                    <input id="roleid" name="roleid" data-name="roleid" type="hidden" />
                    <div class="form-group col-sm-12">
                      <label class="col-sm-2 control-label" for="name">名称</label>
                      <div class="col-sm-10">
                        <input class="form-control required" data-val="true" data-val-required="必填项" id="name" name="name" data-name="name" type="text" />
                      </div>
                    </div>
                    <div class="form-group col-sm-12">
                      <label class="col-sm-2 control-label" for="statecode1">状态</label>
                      <div class="col-sm-10">
                        <label class="checkbox-inline">
                          <input checked="checked" class="required" id="statecode1" name="statecode" data-name="statecode" type="radio" value="true" /> 启用
                        </label>
                        <label class="checkbox-inline">
                          <input class="required" id="statecode0" name="statecode" data-name="statecode" type="radio" value="false" /> 禁用
                        </label>
                      </div>
                    </div>
                    <div class="form-group col-sm-12">
                      <label class="col-sm-2 control-label" for="description">描述</label>
                      <div class="col-sm-10">
                                <textarea class="form-control" id="description" name="description" data-name="description" rows="3">
</textarea>
                      </div>
                    </div>
                    <div class="form-group col-sm-12 text-center" id="form-buttons">
                      <button type="submit" class="btn btn-primary"><span class="glyphicon glyphicon-saved"></span> 保存</button>
                      <button type="reset" class="btn btn-default"><span class="glyphicon glyphicon-refresh"></span> 重置</button>
                    </div>
                  </form>
                </div>
              </div>
            </div>
            <div id="section-2" class="hide">
            </div>
          </div>
        </div>

      </div>
      <nav class="navbar navbar-default navbar-fixed-bottom hide" role="navigation" id="body-footer">
        <div class="container">
          <div class="navbar-form navbar-right" id="body-footer-content">
          </div>
        </div>
      </nav>
    </div>
  </div>
</div>

<script src="/content/js/jquery.form.js"></script>
<script src="/content/js/jquery-validate/jquery.validate.min.js"></script>
<script src="/content/js/jquery-validate/localization/messages_zh.min.js"></script>
<script src="/content/js/xms.fillform.js"></script>
<script>
  var model = $.urlParamObj(location.href);
  $('#roleid').val(model.id);
  function loadData() {
    Xms.Web.GetJson('/api/security/role/getbyid/' + model.id, null, function (res) {
      var data = res.Content;
      if(!data) return;
      $('#editform').fillForm(data);
      if(data.name.toLowerCase() == 'administrator'){
        $('#editform').find('input[data-name=name]').prop('disabled', true);
        $('#editform').find('input[data-name=statecode]').prop('disabled', true);
      }
    }, null, false, 'GET', true);
  }
  $(function () {
    loadData();
    $('#section-2').attr('data-url', ORG_SERVERURL + '/security/role/members?roleid=' + model.id);
    $("#myNav").affix({
      offset: {
        top: 125
      }
    });
    //表单验证
    Xms.Web.Form($("#editform"));
    //
    $('#myNav').on('click', 'a', function (e) {
      var target = $($(this).attr('data-target'));
      var dataUrl = target.attr('data-url');
      $(this).siblings("a").removeClass("active").end().addClass("active");
      if (dataUrl) {
        location.href = dataUrl;
        //target.html('<iframe frameborder="0" src="'+dataUrl+'" width="100%" height="600px"></iframe>');
        //Xms.Web.LoadPage(dataUrl, null, function (data) {
        //    target.html($(data).find('#gridview'));
        //});
      }
      $('#scroll-body > div').addClass('hide');
      target.removeClass('hide');
    });
  });
</script>

</body>
</html>